#ifndef _TTORRENT_H_
#define _TTORRENT_H_    1

#include <glib.h>
#include <gtk/gtk.h>


#define DEBUG(x); fprintf(stderr, "%s\n", x);

typedef struct
{
  guint64 downloaded;
  guint64 uploaded;
  gchar* priorities;
} TSaveState;

typedef struct
{
  gint port_min;
  gint port_max;
  gint active_torrents;
  gint save_freq;
  gint connections;
  gint uploads;
  gint down_speed;
  gint up_speed;
  gint use_dht;
  gint use_pex;
  gdouble seed_ratio;
  gchar * save_dir;
} TSettings;


typedef struct
{
    gchar * conf_dir;
    gint timer;

    //how many torrents on list
    gint count;

    //libtorrent::session*
    gpointer sess;

    //libtorrent::handle*
    gpointer handle;

    //std::vector<libtorrent::peer_info>*
    gpointer peer_info;
    //std::vector<libtorrent::partial_piece_info>*
    gpointer block_info;

    //toplevel window
    GtkWidget * window;
    GtkTreeView * torrents_view;
    //GtkListStore * torrents_model;

    //4x notebook pages
    GtkWidget * info_view;

    GtkTreeView * peers_view;
    GtkTreeView * blocks_view;
    GtkTreeView * files_view;

    GtkWidget * statusbar;
    GtkStatusIcon * icon;
    TSettings * settings;
} TTorrent;

typedef struct
{
  gfloat down_speed;
  gfloat up_speed;
  gint  num_peers;
  gint  dht_nodes;
  gboolean  has_incoming;
} TStatus;

#endif
